window.workspace = function(){
	var response  = <?#$respons?>;
	var store, grid;
	var sid = {'userid':Ext.id(), 'anchorid':Ext.id(), 'sdate':Ext.id(), 'edate':Ext.id()};
	store = new Ext.data.JsonStore({
	    autoDestroy	: true,
	    url			: '/admin/live/log/moneyflow/dolist.html',
	    remoteSort	: true,
	    sortInfo	: {
            field		: 'id',
            direction	: 'DESC'
		},
		baseParams	: {
			start	: 0,
			limit	: main.pageSize
		},
		autoLoad		: true,
	    root			: 'dataset',
	 	totalProperty	: 'total',
	    fields			: ['id', 'usernick', 'anchornick', 'userid',
	        'anchorid', 'reftype', 'refname', 'coinprice', 'earning', 'ip', 'stime']
	});
	
 	grid = {
		xtype		: 'grid',
		title		: response.title,
	    store		: store,
		region		: 'center', 
	    columns		: [
			{header: '编号[ID]', width:60, sortable:true, dataIndex:'id'},
			{header: '消费的会员[Consumer]', width:70, sortable:true, dataIndex:'userid', renderer:function(v,meta,obj){
				if (v) {
					return obj.get('usernick')+'['+v+']';
				}
			}},
			{header: '主播[AnchorNick]', width:70, sortable:true, dataIndex:'anchorid', renderer:function(v,meta,obj){
				if (v) {
					return obj.get('anchornick')+'['+v+']';
				}
			}},
			{header: '消费类型[ConsumeType]',  width:60, dataIndex:'reftype', renderer:function(v){
				return response.rtype[v];
			}},
			{header: '消费名称[Props]', width:80, dataIndex:'refname'},
			{header: '消费的价格[Coins]', width:60, dataIndex:'coinprice'},
			{header: '主播分成收益星币[Earning]', width:60, dataIndex:'earning'},
			{header: 'Ip', width:100, dataIndex:'ip'},
			{header: '消费时间[LastTime]', width:100, dataIndex:'stime'}
		],
	    viewConfig	: {
	        forceFit	 : true,
	        scrollOffset : 0
	    },
	    sm			: new Ext.grid.RowSelectionModel({singleSelect:true}),
	    stripeRows	: true,
	    tbar		: [{
			text	: 'Reload',
			iconCls	: 'icon-refresh',
			handler : function(){
				store.reload(); 
			}
	    },'-','<b>Search For：</b>','Consumer:',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url		: '/admin/live/share/douser.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id	    	    : sid.userid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'Selected...',
			minChars		: 1,
			 pageSize		: 10,
			listWidth		: 258,
			width			: 160,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','Anchor:',{
			xtype		: 'combo',
			store		: new Ext.data.JsonStore({
				url		: '/admin/live/share/douser.html',
				autoDestroy: true,
				fields: ['id', 'name'],
				root: 'dataset'
			}),
			id	    	    : sid.anchorid,
			displayField	: 'name',
			valueField		: 'id',
			emptyText		: 'Selected...',
			minChars		: 1,
			 pageSize		: 10,
			listWidth		: 258,
			width			: 160,
			typeAhead		: true,
			typeAheadDelay  : 0,
			triggerAction	: 'all',
			enableKeyEvents : true,
			mode			: 'remote'
		},'-','LastTime:',{
			xtype       : 'datefield',
			id  		: sid.sdate,
			width	    : 100
		},'<->',{
			xtype       : 'datefield',
			id  		: sid.edate,
			width	    : 100
		},'-',{
			text			: 'Do Search',
			iconCls			: 'icon-search',
			handler: function() {
				store.baseParams.userid    = Ext.getCmp(sid.userid).getValue();
				store.baseParams.anchorid  = Ext.getCmp(sid.anchorid).getValue();
				store.baseParams.sdate     = Ext.getCmp(sid.sdate).getValue();
				store.baseParams.edate     = Ext.getCmp(sid.edate).getValue();
				store.reload(); 
			}
		}],
		bbar		: new Ext.PagingToolbar({
			pageSize	: main.pageSize,
			store		: store,
			displayInfo	: true
		})
	};
	return grid;
}();